@@ -50,7 +50,7 @@ gem 'coffee-rails', '~> 4.0.0' |
||
50 | 50 |
gem 'daemons', '~> 1.1.9' |
51 | 51 |
gem 'delayed_job', '~> 4.0.0' |
52 | 52 |
gem 'delayed_job_active_record', '~> 4.0.0' |
53 |
-gem 'devise', '~> 3.2.4' |
|
53 |
+gem 'devise', '~> 3.4.0' |
|
54 | 54 |
gem 'em-http-request', '~> 1.1.2' |
55 | 55 |
gem 'faraday', '~> 0.9.0' |
56 | 56 |
gem 'faraday_middleware' |
@@ -82,10 +82,11 @@ GEM |
||
82 | 82 |
delayed_job (>= 3.0, < 4.1) |
83 | 83 |
delorean (2.1.0) |
84 | 84 |
chronic |
85 |
- devise (3.2.4) |
|
85 |
+ devise (3.4.0) |
|
86 | 86 |
bcrypt (~> 3.0) |
87 | 87 |
orm_adapter (~> 0.1) |
88 | 88 |
railties (>= 3.2.6, < 5) |
89 |
+ responders |
|
89 | 90 |
thread_safe (~> 0.1) |
90 | 91 |
warden (~> 1.2.3) |
91 | 92 |
diff-lcs (1.2.5) |
@@ -264,6 +265,8 @@ GEM |
||
264 | 265 |
rdoc (4.1.1) |
265 | 266 |
json (~> 1.4) |
266 | 267 |
ref (1.0.5) |
268 |
+ responders (1.1.1) |
|
269 |
+ railties (>= 3.2, < 4.2) |
|
267 | 270 |
rest-client (1.6.8) |
268 | 271 |
mime-types (~> 1.16) |
269 | 272 |
rdoc (>= 2.4.2) |
@@ -420,7 +423,7 @@ DEPENDENCIES |
||
420 | 423 |
delayed_job (~> 4.0.0) |
421 | 424 |
delayed_job_active_record (~> 4.0.0) |
422 | 425 |
delorean |
423 |
- devise (~> 3.2.4) |
|
426 |
+ devise (~> 3.4.0) |
|
424 | 427 |
dotenv-deployment |
425 | 428 |
dotenv-rails |
426 | 429 |
dropbox-api |
@@ -0,0 +1,15 @@ |
||
1 |
+class OmniauthCallbacksController < Devise::OmniauthCallbacksController |
|
2 |
+ def action_missing(name) |
|
3 |
+ case name.to_sym |
|
4 |
+ when *Devise.omniauth_providers |
|
5 |
+ service = current_user.services.initialize_or_update_via_omniauth(request.env['omniauth.auth']) |
|
6 |
+ if service && service.save |
|
7 |
+ redirect_to services_path, notice: "The service was successfully created." |
|
8 |
+ else |
|
9 |
+ redirect_to services_path, error: "Error creating the service." |
|
10 |
+ end |
|
11 |
+ else |
|
12 |
+ raise ActionController::RoutingError, 'not found' |
|
13 |
+ end |
|
14 |
+ end |
|
15 |
+end |
@@ -33,13 +33,4 @@ class ServicesController < ApplicationController |
||
33 | 33 |
format.json { render json: @service } |
34 | 34 |
end |
35 | 35 |
end |
36 |
- |
|
37 |
- def callback |
|
38 |
- @service = current_user.services.initialize_or_update_via_omniauth(request.env['omniauth.auth']) |
|
39 |
- if @service && @service.save |
|
40 |
- redirect_to services_path, notice: "The service was successfully created." |
|
41 |
- else |
|
42 |
- redirect_to services_path, error: "Error creating the service." |
|
43 |
- end |
|
44 |
- end |
|
45 | 36 |
end |
@@ -4,18 +4,18 @@ |
||
4 | 4 |
|
5 | 5 |
<h2>Resend confirmation instructions</h2> |
6 | 6 |
|
7 |
- <%= form_for(resource, :as => resource_name, :url => confirmation_path(resource_name), :html => { :method => :post, :class => 'form-horizontal' }) do |f| %> |
|
7 |
+ <%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post, class: 'form-horizontal' }) do |f| %> |
|
8 | 8 |
<%= devise_error_messages! %> |
9 | 9 |
|
10 | 10 |
<div class="form-group"> |
11 | 11 |
<%= f.label :email %> |
12 |
- <%= f.email_field :email, :class => 'form-control' %> |
|
12 |
+ <%= f.email_field :email, autofocus: true, class: 'form-control' %> |
|
13 | 13 |
</div> |
14 | 14 |
|
15 |
- <%= f.submit "Resend confirmation instructions", :class => "btn btn-primary" %> |
|
15 |
+ <%= f.submit "Resend confirmation instructions", class: "btn btn-primary" %> |
|
16 | 16 |
<% end %> |
17 | 17 |
|
18 | 18 |
<%= render "devise/shared/links" %> |
19 | 19 |
</div> |
20 | 20 |
</div> |
21 |
-</div> |
|
21 |
+</div> |
@@ -1,5 +1,5 @@ |
||
1 |
-<p>Welcome <%= @resource.email %>!</p> |
|
1 |
+<p>Welcome <%= @email %>!</p> |
|
2 | 2 |
|
3 | 3 |
<p>You can confirm your account email through the link below:</p> |
4 | 4 |
|
5 |
-<p><%= link_to 'Confirm my account', confirmation_url(@resource, :confirmation_token => @resource.confirmation_token) %></p> |
|
5 |
+<p><%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></p> |
@@ -1,8 +1,8 @@ |
||
1 | 1 |
<p>Hello <%= @resource.email %>!</p> |
2 | 2 |
|
3 |
-<p>Someone has requested a link to change your password, and you can do this through the link below.</p> |
|
3 |
+<p>Someone has requested a link to change your password. You can do this through the link below.</p> |
|
4 | 4 |
|
5 |
-<p><%= link_to 'Change my password', edit_password_url(@resource, :reset_password_token => @resource.reset_password_token) %></p> |
|
5 |
+<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p> |
|
6 | 6 |
|
7 | 7 |
<p>If you didn't request this, please ignore this email.</p> |
8 | 8 |
<p>Your password won't change until you access the link above and create a new one.</p> |
@@ -1,7 +1,7 @@ |
||
1 | 1 |
<p>Hello <%= @resource.email %>!</p> |
2 | 2 |
|
3 |
-<p>Your account has been locked due to an excessive amount of unsuccessful sign in attempts.</p> |
|
3 |
+<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p> |
|
4 | 4 |
|
5 | 5 |
<p>Click the link below to unlock your account:</p> |
6 | 6 |
|
7 |
-<p><%= link_to 'Unlock my account', unlock_url(@resource, :unlock_token => @resource.unlock_token) %></p> |
|
7 |
+<p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p> |
@@ -4,26 +4,26 @@ |
||
4 | 4 |
<div class='well'> |
5 | 5 |
<h2>Change your password</h2> |
6 | 6 |
|
7 |
- <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :put, :class => 'form-horizontal' }) do |f| %> |
|
7 |
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put, class: 'form-horizontal' }) do |f| %> |
|
8 | 8 |
<%= devise_error_messages! %> |
9 | 9 |
<%= f.hidden_field :reset_password_token %> |
10 | 10 |
|
11 | 11 |
<div class="control-group"> |
12 |
- <%= f.label :password, "New password", :class => 'control-label' %> |
|
12 |
+ <%= f.label :password, "New password", class: 'control-label' %> |
|
13 | 13 |
<div class="controls"> |
14 |
- <%= f.password_field :password, :class => 'span4' %> |
|
14 |
+ <%= f.password_field :password, autofocus: true, autocomplete: "off", class: 'span4' %> |
|
15 | 15 |
</div> |
16 | 16 |
</div> |
17 | 17 |
|
18 | 18 |
<div class="control-group"> |
19 |
- <%= f.label :password_confirmation, "Confirm new password", :class => 'control-label' %> |
|
19 |
+ <%= f.label :password_confirmation, "Confirm new password" %> |
|
20 | 20 |
<div class="controls"> |
21 |
- <%= f.password_field :password_confirmation, :class => 'span4' %> |
|
21 |
+ <%= f.password_field :password_confirmation, autocomplete: "off", class: 'span4' %> |
|
22 | 22 |
</div> |
23 | 23 |
</div> |
24 | 24 |
|
25 | 25 |
<div class='form-actions'> |
26 |
- <%= f.submit "Change my password", :class => "btn btn-primary" %> |
|
26 |
+ <%= f.submit "Change my password", class: "btn btn-primary" %> |
|
27 | 27 |
</div> |
28 | 28 |
<% end %> |
29 | 29 |
|
@@ -31,4 +31,4 @@ |
||
31 | 31 |
</div> |
32 | 32 |
</div> |
33 | 33 |
</div> |
34 |
-</div> |
|
34 |
+</div> |
@@ -3,19 +3,19 @@ |
||
3 | 3 |
<div class='well'> |
4 | 4 |
<h2>Forgot your password?</h2> |
5 | 5 |
|
6 |
- <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post, :class => 'form-horizontal' }) do |f| %> |
|
6 |
+ <%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post, class: 'form-horizontal' }) do |f| %> |
|
7 | 7 |
<%= devise_error_messages! %> |
8 | 8 |
|
9 | 9 |
<div class="form-group"> |
10 | 10 |
<%= f.label :login, :class => 'col-md-2 col-md-offset-2 control-label' %> |
11 | 11 |
<div class="col-md-6"> |
12 |
- <%= f.text_field :login, :class => 'form-control' %> |
|
12 |
+ <%= f.text_field :login, autofocus: true, :class => 'form-control' %> |
|
13 | 13 |
</div> |
14 | 14 |
</div> |
15 | 15 |
|
16 | 16 |
<div class="form-group"> |
17 | 17 |
<div class="col-md-offset-4 col-md-10"> |
18 |
- <%= f.submit "Send me reset password instructions", :class => "btn btn-primary" %> |
|
18 |
+ <%= f.submit "Send me reset password instructions", class: "btn btn-primary" %> |
|
19 | 19 |
</div> |
20 | 20 |
</div> |
21 | 21 |
<% end %> |
@@ -25,4 +25,4 @@ |
||
25 | 25 |
<%= render "devise/shared/links" %> |
26 | 26 |
</div> |
27 | 27 |
</div> |
28 |
-</div> |
|
28 |
+</div> |
@@ -5,66 +5,70 @@ |
||
5 | 5 |
|
6 | 6 |
<h2>Edit <%= resource_name.to_s.humanize %></h2> |
7 | 7 |
|
8 |
- <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put, :class => 'form-horizontal' }) do |f| %> |
|
8 |
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put, class: 'form-horizontal' }) do |f| %> |
|
9 | 9 |
<%= devise_error_messages! %> |
10 | 10 |
|
11 | 11 |
<div class="form-group"> |
12 |
- <%= f.label :email, :class => 'col-md-4 control-label' %> |
|
12 |
+ <%= f.label :email, class: 'col-md-4 control-label' %> |
|
13 | 13 |
<div class="col-md-6"> |
14 |
- <%= f.email_field :email, :class => 'form-control' %> |
|
14 |
+ <%= f.email_field :email, autofocus: true, class: 'form-control' %> |
|
15 | 15 |
</div> |
16 | 16 |
</div> |
17 | 17 |
|
18 |
+ <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> |
|
19 |
+ <div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div> |
|
20 |
+ <% end %> |
|
21 |
+ |
|
18 | 22 |
<div class="form-group"> |
19 |
- <%= f.label :username, :class => 'col-md-4 control-label' %> |
|
23 |
+ <%= f.label :username, class: 'col-md-4 control-label' %> |
|
20 | 24 |
<div class="col-md-6"> |
21 |
- <%= f.text_field :username, :class => 'form-control' %> |
|
25 |
+ <%= f.text_field :username, class: 'form-control' %> |
|
22 | 26 |
</div> |
23 | 27 |
</div> |
24 | 28 |
|
25 | 29 |
<div class="form-group"> |
26 |
- <%= f.label :current_password, :class => 'col-md-4 control-label' %> |
|
30 |
+ <%= f.label :current_password, class: 'col-md-4 control-label' %> |
|
27 | 31 |
<div class="col-md-6"> |
28 |
- <%= f.password_field :current_password, :class => 'form-control' %> |
|
32 |
+ <%= f.password_field :current_password, class: 'form-control' %> |
|
29 | 33 |
<span class='help-inline'>We need your current password to confirm your changes.</span> |
30 | 34 |
</div> |
31 | 35 |
</div> |
32 |
- |
|
36 |
+ |
|
33 | 37 |
<div class="form-group"> |
34 | 38 |
<div class="col-md-offset-4 col-md-10"> |
35 |
- <%= f.submit "Update", :class => "btn btn-primary" %> |
|
39 |
+ <%= f.submit "Update", class: "btn btn-primary" %> |
|
36 | 40 |
</div> |
37 | 41 |
</div> |
38 | 42 |
<% end %> |
39 | 43 |
|
40 | 44 |
<h3>Change password</h3> |
41 |
- <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put, :class => 'form-horizontal' }) do |f| %> |
|
45 |
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put, class: 'form-horizontal' }) do |f| %> |
|
42 | 46 |
<%= devise_error_messages! %> |
43 | 47 |
<div class="form-group"> |
44 |
- <%= f.label :current_password, :class => 'col-md-4 control-label' %> |
|
48 |
+ <%= f.label :current_password, class: 'col-md-4 control-label' %> |
|
45 | 49 |
<div class="col-md-6"> |
46 |
- <%= f.password_field :current_password, :class => 'form-control' %> |
|
50 |
+ <%= f.password_field :current_password, class: 'form-control' %> |
|
47 | 51 |
<span class='help-inline'>We need your current password to confirm your changes.</span> |
48 | 52 |
</div> |
49 | 53 |
</div> |
50 | 54 |
|
51 | 55 |
<div class="form-group"> |
52 |
- <%= f.label :password, :class => 'col-md-4 control-label' %> |
|
56 |
+ <%= f.label :password, class: 'col-md-4 control-label' %> |
|
53 | 57 |
<div class="col-md-6"> |
54 |
- <%= f.password_field :password, :autocomplete => "off", :class => 'form-control' %> |
|
58 |
+ <%= f.password_field :password, autocomplete: "off", class: 'form-control' %> |
|
55 | 59 |
</div> |
56 | 60 |
</div> |
57 | 61 |
|
58 | 62 |
<div class="form-group"> |
59 |
- <%= f.label :password_confirmation, :class => 'col-md-4 control-label' %> |
|
63 |
+ <%= f.label :password_confirmation, class: 'col-md-4 control-label' %> |
|
60 | 64 |
<div class="col-md-6"> |
61 |
- <%= f.password_field :password_confirmation, :class => 'form-control' %> |
|
65 |
+ <%= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control' %> |
|
62 | 66 |
</div> |
63 | 67 |
</div> |
64 | 68 |
|
65 | 69 |
<div class="form-group"> |
66 | 70 |
<div class="col-md-offset-4 col-md-10"> |
67 |
- <%= f.submit "Update", :class => "btn btn-primary" %> |
|
71 |
+ <%= f.submit "Update", class: "btn btn-primary" %> |
|
68 | 72 |
</div> |
69 | 73 |
</div> |
70 | 74 |
|
@@ -74,7 +78,7 @@ |
||
74 | 78 |
|
75 | 79 |
<h3>Cancel my account</h3> |
76 | 80 |
|
77 |
- <p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete %>.</p> |
|
81 |
+ <p>Unhappy? <%= link_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p> |
|
78 | 82 |
|
79 | 83 |
<%= link_to "Back", :back %> |
80 | 84 |
</div> |
@@ -3,9 +3,9 @@ |
||
3 | 3 |
<div class='col-md-8 col-md-offset-2'> |
4 | 4 |
<div class='well'> |
5 | 5 |
|
6 |
- <h2>Sign Up</h2> |
|
6 |
+ <h2>Sign up</h2> |
|
7 | 7 |
|
8 |
- <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :class => 'form-horizontal' }) do |f| %> |
|
8 |
+ <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { class: 'form-horizontal' }) do |f| %> |
|
9 | 9 |
<%= devise_error_messages! %> |
10 | 10 |
<% if ENV['ON_HEROKU'] && User.count.zero? %> |
11 | 11 |
<div class="heroku-instructions"> |
@@ -31,44 +31,45 @@ bin/setup_heroku |
||
31 | 31 |
<% end %> |
32 | 32 |
|
33 | 33 |
<div class="form-group"> |
34 |
- <%= f.label :invitation_code, :class => 'col-md-4 control-label' %> |
|
34 |
+ <%= f.label :invitation_code, class: 'col-md-4 control-label' %> |
|
35 | 35 |
<div class="col-md-6"> |
36 |
- <%= f.text_field :invitation_code, :class => 'form-control' %> |
|
36 |
+ <%= f.text_field :invitation_code, class: 'form-control' %> |
|
37 | 37 |
<span class="help-inline">We are not yet open to the public. If you have an invitation code, please enter it here.</span> |
38 | 38 |
</div> |
39 | 39 |
</div> |
40 | 40 |
|
41 | 41 |
<div class="form-group"> |
42 |
- <%= f.label :email, :class => 'col-md-4 control-label' %> |
|
42 |
+ <%= f.label :email, class: 'col-md-4 control-label' %> |
|
43 | 43 |
<div class="col-md-6"> |
44 |
- <%= f.email_field :email, :class => 'form-control' %> |
|
44 |
+ <%= f.email_field :email, autofocus: true, class: 'form-control' %> |
|
45 | 45 |
</div> |
46 | 46 |
</div> |
47 | 47 |
|
48 | 48 |
<div class="form-group"> |
49 |
- <%= f.label :username, :class => 'col-md-4 control-label' %> |
|
49 |
+ <%= f.label :username, class: 'col-md-4 control-label' %> |
|
50 | 50 |
<div class="col-md-6"> |
51 |
- <%= f.text_field :username, :class => 'form-control' %> |
|
51 |
+ <%= f.text_field :username, class: 'form-control' %> |
|
52 | 52 |
</div> |
53 | 53 |
</div> |
54 | 54 |
|
55 | 55 |
<div class="form-group"> |
56 |
- <%= f.label :password, :class => 'col-md-4 control-label' %> |
|
56 |
+ <%= f.label :password, class: 'col-md-4 control-label' %> |
|
57 | 57 |
<div class="col-md-6"> |
58 |
- <%= f.password_field :password, :autocomplete => "off", :class => 'form-control' %> |
|
58 |
+ <%= f.password_field :password, autocomplete: "off", class: 'form-control' %> |
|
59 |
+ <% if @validatable %><span class="help-inline"><%= @minimum_password_length %> characters minimum.</span><% end %> |
|
59 | 60 |
</div> |
60 | 61 |
</div> |
61 | 62 |
|
62 | 63 |
<div class="form-group"> |
63 |
- <%= f.label :password_confirmation, :class => 'col-md-4 control-label' %> |
|
64 |
+ <%= f.label :password_confirmation, class: 'col-md-4 control-label' %> |
|
64 | 65 |
<div class="col-md-6"> |
65 |
- <%= f.password_field :password_confirmation, :class => 'form-control' %> |
|
66 |
+ <%= f.password_field :password_confirmation, autocomplete: "off", class: 'form-control' %> |
|
66 | 67 |
</div> |
67 | 68 |
</div> |
68 | 69 |
|
69 | 70 |
<div class="form-group"> |
70 | 71 |
<div class="col-md-offset-4 col-md-10"> |
71 |
- <%= f.submit "Sign Up", :class => "btn btn-primary" %> |
|
72 |
+ <%= f.submit "Sign up", class: "btn btn-primary" %> |
|
72 | 73 |
</div> |
73 | 74 |
</div> |
74 | 75 |
|
@@ -2,29 +2,29 @@ |
||
2 | 2 |
<div class='col-md-6 col-md-offset-3'> |
3 | 3 |
<div class='well'> |
4 | 4 |
|
5 |
- <h2>Sign in</h2> |
|
5 |
+ <h2>Log in</h2> |
|
6 | 6 |
|
7 |
- <%= form_for(resource, :as => resource_name, :url => session_path(resource_name), :html => { :class => 'form-horizontal', :role => 'form'}) do |f| %> |
|
7 |
+ <%= form_for(resource, as: resource_name, url: session_path(resource_name), html: { class: 'form-horizontal', role: 'form'}) do |f| %> |
|
8 | 8 |
<div class="form-group"> |
9 |
- <%= f.label :login, :class => 'col-md-2 col-md-offset-2 control-label' %> |
|
9 |
+ <%= f.label :login, class: 'col-md-2 col-md-offset-2 control-label' %> |
|
10 | 10 |
<div class="col-md-6"> |
11 |
- <%= f.text_field :login, :class => 'form-control' %> |
|
11 |
+ <%= f.text_field :login, autofocus: true, class: 'form-control' %> |
|
12 | 12 |
</div> |
13 | 13 |
</div> |
14 | 14 |
|
15 | 15 |
<div class="form-group"> |
16 |
- <%= f.label :password, :class => 'col-md-2 col-md-offset-2 control-label' %> |
|
16 |
+ <%= f.label :password, class: 'col-md-2 col-md-offset-2 control-label' %> |
|
17 | 17 |
<div class="col-md-6"> |
18 |
- <%= f.password_field :password, :class => 'form-control' %> |
|
18 |
+ <%= f.password_field :password, class: 'form-control' %> |
|
19 | 19 |
</div> |
20 | 20 |
</div> |
21 | 21 |
|
22 | 22 |
<div class="form-group"> |
23 | 23 |
<div class="col-md-offset-4 col-md-10"> |
24 |
- <% if devise_mapping.rememberable? %> |
|
24 |
+ <% if devise_mapping.rememberable? -%> |
|
25 | 25 |
<div class="checkbox"> |
26 | 26 |
<label> |
27 |
- <%= f.check_box :remember_me %> Remember me |
|
27 |
+ <%= f.check_box :remember_me %> <%= f.label :remember_me %> |
|
28 | 28 |
</label> |
29 | 29 |
</div> |
30 | 30 |
<% end -%> |
@@ -33,7 +33,7 @@ |
||
33 | 33 |
|
34 | 34 |
<div class="form-group"> |
35 | 35 |
<div class="col-md-offset-4 col-md-10"> |
36 |
- <%= f.submit "Sign in", :class => "btn btn-default" %> |
|
36 |
+ <%= f.submit "Log in", class: "btn btn-default" %> |
|
37 | 37 |
</div> |
38 | 38 |
</div> |
39 | 39 |
<% end %> |
@@ -43,4 +43,4 @@ |
||
43 | 43 |
<%= render "devise/shared/links" %> |
44 | 44 |
</div> |
45 | 45 |
</div> |
46 |
-</div> |
|
46 |
+</div> |
@@ -1,12 +1,12 @@ |
||
1 | 1 |
<%- if controller_name != 'sessions' %> |
2 |
- <%= link_to "Sign in", new_session_path(resource_name) %><br /> |
|
2 |
+ <%= link_to "Log in", new_session_path(resource_name) %><br /> |
|
3 | 3 |
<% end -%> |
4 | 4 |
|
5 | 5 |
<%- if devise_mapping.registerable? && controller_name != 'registrations' %> |
6 | 6 |
<%= link_to "Sign up", new_registration_path(resource_name) %><br /> |
7 | 7 |
<% end -%> |
8 | 8 |
|
9 |
-<%- if devise_mapping.recoverable? && controller_name != 'passwords' %> |
|
9 |
+<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %> |
|
10 | 10 |
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br /> |
11 | 11 |
<% end -%> |
12 | 12 |
|
@@ -3,19 +3,19 @@ |
||
3 | 3 |
<div class='well'> |
4 | 4 |
<h2>Resend unlock instructions</h2> |
5 | 5 |
|
6 |
- <%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post, :class => 'form-horizontal' }) do |f| %> |
|
6 |
+ <%= form_for(resource, as: resource_name, url: unlock_path(resource_name), html: { method: :post, class: 'form-horizontal' }) do |f| %> |
|
7 | 7 |
<%= devise_error_messages! %> |
8 | 8 |
|
9 | 9 |
<div class="form-group"> |
10 |
- <%= f.label :email, :class => 'col-md-2 col-md-offset-2 control-label' %> |
|
10 |
+ <%= f.label :email, class: 'col-md-2 col-md-offset-2 control-label' %> |
|
11 | 11 |
<div class="col-md-6"> |
12 |
- <%= f.text_field :email, :class => 'form-control' %> |
|
12 |
+ <%= f.email_field :email, autofocus: true, class: 'form-control' %> |
|
13 | 13 |
</div> |
14 | 14 |
</div> |
15 | 15 |
|
16 | 16 |
<div class="form-group"> |
17 | 17 |
<div class="col-md-offset-4 col-md-10"> |
18 |
- <%= f.submit "Resend unlock instructions", :class => "btn btn-primary" %> |
|
18 |
+ <%= f.submit "Resend unlock instructions", class: "btn btn-primary" %> |
|
19 | 19 |
</div> |
20 | 20 |
</div> |
21 | 21 |
<% end %> |
@@ -25,4 +25,4 @@ |
||
25 | 25 |
<%= render "devise/shared/links" %> |
26 | 26 |
</div> |
27 | 27 |
</div> |
28 |
-</div> |
|
28 |
+</div> |
@@ -5,10 +5,10 @@ Devise.setup do |config| |
||
5 | 5 |
# Configure the e-mail address which will be shown in Devise::Mailer, |
6 | 6 |
# note that it will be overwritten if you use your own mailer class |
7 | 7 |
# with default "from" parameter. |
8 |
- config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com" |
|
8 |
+ config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' |
|
9 | 9 |
|
10 | 10 |
# Configure the class responsible to send e-mails. |
11 |
- # config.mailer = "Devise::Mailer" |
|
11 |
+ # config.mailer = 'Devise::Mailer' |
|
12 | 12 |
|
13 | 13 |
# ==> ORM configuration |
14 | 14 |
# Load and configure the ORM. Supports :active_record (default) and |
@@ -49,17 +49,18 @@ Devise.setup do |config| |
||
49 | 49 |
# enable it only for database (email + password) authentication. |
50 | 50 |
# config.params_authenticatable = true |
51 | 51 |
|
52 |
- # Tell if authentication through HTTP Basic Auth is enabled. False by default. |
|
52 |
+ # Tell if authentication through HTTP Auth is enabled. False by default. |
|
53 | 53 |
# It can be set to an array that will enable http authentication only for the |
54 |
- # given strategies, for example, `config.http_authenticatable = [:token]` will |
|
55 |
- # enable it only for token authentication. |
|
54 |
+ # given strategies, for example, `config.http_authenticatable = [:database]` will |
|
55 |
+ # enable it only for database authentication. The supported strategies are: |
|
56 |
+ # :database = Support basic authentication with authentication key + password |
|
56 | 57 |
# config.http_authenticatable = false |
57 | 58 |
|
58 |
- # If http headers should be returned for AJAX requests. True by default. |
|
59 |
+ # If 401 status code should be returned for AJAX requests. True by default. |
|
59 | 60 |
# config.http_authenticatable_on_xhr = true |
60 | 61 |
|
61 |
- # The realm used in Http Basic Authentication. "Application" by default. |
|
62 |
- # config.http_authentication_realm = "Application" |
|
62 |
+ # The realm used in Http Basic Authentication. 'Application' by default. |
|
63 |
+ # config.http_authentication_realm = 'Application' |
|
63 | 64 |
|
64 | 65 |
# It will change confirmation, password recovery and other workflows |
65 | 66 |
# to behave the same regardless if the e-mail provided was right or wrong. |
@@ -67,10 +68,10 @@ Devise.setup do |config| |
||
67 | 68 |
# config.paranoid = true |
68 | 69 |
|
69 | 70 |
# By default Devise will store the user in session. You can skip storage for |
70 |
- # :http_auth and :token_auth by adding those symbols to the array below. |
|
71 |
+ # particular strategies by setting this option. |
|
71 | 72 |
# Notice that if you are skipping storage for all authentication paths, you |
72 | 73 |
# may want to disable generating routes to Devise's sessions controller by |
73 |
- # passing :skip => :sessions to `devise_for` in your config/routes.rb |
|
74 |
+ # passing skip: :sessions to `devise_for` in your config/routes.rb |
|
74 | 75 |
config.skip_session_storage = [:http_auth] |
75 | 76 |
|
76 | 77 |
# By default, Devise cleans up the CSRF token on authentication to |
@@ -85,7 +86,9 @@ Devise.setup do |config| |
||
85 | 86 |
# |
86 | 87 |
# Limiting the stretches to just one in testing will increase the performance of |
87 | 88 |
# your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use |
88 |
- # a value less than 10 in other environments. |
|
89 |
+ # a value less than 10 in other environments. Note that, for bcrypt (the default |
|
90 |
+ # encryptor), the cost increases exponentially with the number of stretches (e.g. |
|
91 |
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation). |
|
89 | 92 |
config.stretches = Rails.env.test? ? 1 : 10 |
90 | 93 |
|
91 | 94 |
# Setup a pepper to generate the encrypted password. |
@@ -93,16 +96,24 @@ Devise.setup do |config| |
||
93 | 96 |
|
94 | 97 |
# ==> Configuration for :confirmable |
95 | 98 |
# A period that the user is allowed to access the website even without |
96 |
- # confirming his account. For instance, if set to 2.days, the user will be |
|
97 |
- # able to access the website for two days without confirming his account, |
|
99 |
+ # confirming their account. For instance, if set to 2.days, the user will be |
|
100 |
+ # able to access the website for two days without confirming their account, |
|
98 | 101 |
# access will be blocked just in the third day. Default is 0.days, meaning |
99 |
- # the user cannot access the website without confirming his account. |
|
102 |
+ # the user cannot access the website without confirming their account. |
|
100 | 103 |
# config.allow_unconfirmed_access_for = 2.days |
101 | 104 |
|
105 |
+ # A period that the user is allowed to confirm their account before their |
|
106 |
+ # token becomes invalid. For example, if set to 3.days, the user can confirm |
|
107 |
+ # their account within 3 days after the mail was sent, but on the fourth day |
|
108 |
+ # their account can't be confirmed with the token any more. |
|
109 |
+ # Default is nil, meaning there is no restriction on how long a user can take |
|
110 |
+ # before confirming their account. |
|
111 |
+ # config.confirm_within = 3.days |
|
112 |
+ |
|
102 | 113 |
# If true, requires any email changes to be confirmed (exactly the same way as |
103 | 114 |
# initial account confirmation) to be applied. Requires additional unconfirmed_email |
104 |
- # db field (see migrations). Until confirmed new email is stored in |
|
105 |
- # unconfirmed email column, and copied to email column on successful confirmation. |
|
115 |
+ # db field (see migrations). Until confirmed, new email is stored in |
|
116 |
+ # unconfirmed_email column, and copied to email column on successful confirmation. |
|
106 | 117 |
config.reconfirmable = true |
107 | 118 |
|
108 | 119 |
# Defines which key will be used when confirming an account |
@@ -112,23 +123,26 @@ Devise.setup do |config| |
||
112 | 123 |
# The time the user will be remembered without asking for credentials again. |
113 | 124 |
config.remember_for = 4.weeks |
114 | 125 |
|
126 |
+ # Invalidates all the remember me tokens when the user signs out. |
|
127 |
+ config.expire_all_remember_me_on_sign_out = true |
|
128 |
+ |
|
115 | 129 |
# If true, extends the user's remember period when remembered via cookie. |
116 | 130 |
# config.extend_remember_period = false |
117 | 131 |
|
118 | 132 |
# Options to be passed to the created cookie. For instance, you can set |
119 |
- # :secure => true in order to force SSL only cookies. |
|
133 |
+ # secure: true in order to force SSL only cookies. |
|
120 | 134 |
if Rails.env.production? |
121 |
- config.rememberable_options = { :secure => true } |
|
135 |
+ config.rememberable_options = { secure: true } |
|
122 | 136 |
else |
123 | 137 |
config.rememberable_options = { } |
124 | 138 |
end |
125 | 139 |
|
126 | 140 |
# ==> Configuration for :validatable |
127 |
- # Range for password length. Default is 6..128. |
|
128 |
- # config.password_length = 6..128 |
|
141 |
+ # Range for password length. |
|
142 |
+ config.password_length = 8..128 |
|
129 | 143 |
|
130 | 144 |
# Email regex used to validate email formats. It simply asserts that |
131 |
- # an one (and only one) @ exists in the given string. This is mainly |
|
145 |
+ # one (and only one) @ exists in the given string. This is mainly |
|
132 | 146 |
# to give user feedback and not to assert the e-mail validity. |
133 | 147 |
# config.email_regexp = /\A[^@]+@[^@]+\z/ |
134 | 148 |
|
@@ -163,6 +177,9 @@ Devise.setup do |config| |
||
163 | 177 |
# Time interval to unlock the account if :time is enabled as unlock_strategy. |
164 | 178 |
config.unlock_in = 1.hour |
165 | 179 |
|
180 |
+ # Warn on the last attempt before the account is locked. |
|
181 |
+ # config.last_attempt_warning = true |
|
182 |
+ |
|
166 | 183 |
# ==> Configuration for :recoverable |
167 | 184 |
# |
168 | 185 |
# Defines which key will be used when recovering the password for an account |
@@ -178,7 +195,9 @@ Devise.setup do |config| |
||
178 | 195 |
# :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1, |
179 | 196 |
# :authlogic_sha512 (then you should set stretches above to 20 for default behavior) |
180 | 197 |
# and :restful_authentication_sha1 (then you should set stretches to 10, and copy |
181 |
- # REST_AUTH_SITE_KEY to pepper) |
|
198 |
+ # REST_AUTH_SITE_KEY to pepper). |
|
199 |
+ # |
|
200 |
+ # Require the `devise-encryptable` gem when using anything other than bcrypt |
|
182 | 201 |
# config.encryptor = :sha512 |
183 | 202 |
|
184 | 203 |
# ==> Scopes configuration |
@@ -204,7 +223,7 @@ Devise.setup do |config| |
||
204 | 223 |
# should add them to the navigational formats lists. |
205 | 224 |
# |
206 | 225 |
# The "*/*" below is required to match Internet Explorer requests. |
207 |
- # config.navigational_formats = ["*/*", :html] |
|
226 |
+ # config.navigational_formats = ['*/*', :html] |
|
208 | 227 |
|
209 | 228 |
# The default HTTP method used to sign out a resource. Default is :delete. |
210 | 229 |
config.sign_out_via = :get |
@@ -212,7 +231,7 @@ Devise.setup do |config| |
||
212 | 231 |
# ==> OmniAuth |
213 | 232 |
# Add a new OmniAuth provider. Check the wiki for more information on setting |
214 | 233 |
# up on your models and hooks. |
215 |
- # config.omniauth :github, 'APP_ID', 'APP_SECRET', :scope => 'user,public_repo' |
|
234 |
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo' |
|
216 | 235 |
|
217 | 236 |
if defined?(OmniAuth::Strategies::Twitter) && |
218 | 237 |
(key = ENV["TWITTER_OAUTH_KEY"]).present? && |
@@ -250,7 +269,7 @@ Devise.setup do |config| |
||
250 | 269 |
# |
251 | 270 |
# config.warden do |manager| |
252 | 271 |
# manager.intercept_401 = false |
253 |
- # manager.default_strategies(:scope => :user).unshift :some_external_strategy |
|
272 |
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy |
|
254 | 273 |
# end |
255 | 274 |
|
256 | 275 |
# ==> Mountable engine configurations |
@@ -258,13 +277,13 @@ Devise.setup do |config| |
||
258 | 277 |
# is mountable, there are some extra configurations to be taken into account. |
259 | 278 |
# The following options are available, assuming the engine is mounted as: |
260 | 279 |
# |
261 |
- # mount MyEngine, at: "/my_engine" |
|
280 |
+ # mount MyEngine, at: '/my_engine' |
|
262 | 281 |
# |
263 | 282 |
# The router that invoked `devise_for`, in the example above, would be: |
264 | 283 |
# config.router_name = :my_engine |
265 | 284 |
# |
266 | 285 |
# When using omniauth, Devise cannot automatically set Omniauth path, |
267 | 286 |
# so you need to do it manually. For the users scope, it would be: |
268 |
- # config.omniauth_path_prefix = "/my_engine/users/auth" |
|
287 |
+ # config.omniauth_path_prefix = '/my_engine/users/auth' |
|
269 | 288 |
config.omniauth_path_prefix = "/auth" |
270 | 289 |
end |
@@ -1,64 +1,66 @@ |
||
1 | 1 |
# Additional translations at https://github.com/plataformatec/devise/wiki/I18n |
2 | 2 |
|
3 | 3 |
en: |
4 |
+ devise: |
|
5 |
+ confirmations: |
|
6 |
+ confirmed: "Your email address has been successfully confirmed." |
|
7 |
+ send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes." |
|
8 |
+ send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes." |
|
9 |
+ failure: |
|
10 |
+ already_authenticated: "You are already signed in." |
|
11 |
+ inactive: "Your account is not activated yet." |
|
12 |
+ invalid: "Invalid %{authentication_keys} or password." |
|
13 |
+ locked: "Your account is locked." |
|
14 |
+ last_attempt: "You have one more attempt before your account is locked." |
|
15 |
+ not_found_in_database: "Invalid %{authentication_keys} or password." |
|
16 |
+ timeout: "Your session expired. Please sign in again to continue." |
|
17 |
+ unauthenticated: "You need to sign in or sign up before continuing." |
|
18 |
+ unconfirmed: "You have to confirm your email address before continuing." |
|
19 |
+ mailer: |
|
20 |
+ confirmation_instructions: |
|
21 |
+ subject: "Confirmation instructions" |
|
22 |
+ reset_password_instructions: |
|
23 |
+ subject: "Reset password instructions" |
|
24 |
+ unlock_instructions: |
|
25 |
+ subject: "Unlock instructions" |
|
26 |
+ omniauth_callbacks: |
|
27 |
+ failure: "Could not authenticate you from %{kind} because \"%{reason}\"." |
|
28 |
+ success: "Successfully authenticated from %{kind} account." |
|
29 |
+ omniauth_providers: |
|
30 |
+ twitter: "Twitter" |
|
31 |
+ tumblr: "Tumblr" |
|
32 |
+ github: "GitHub" |
|
33 |
+ 37signals: "37Signals (Basecamp)" |
|
34 |
+ dropbox: "Dropbox" |
|
35 |
+ passwords: |
|
36 |
+ no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided." |
|
37 |
+ send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes." |
|
38 |
+ send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes." |
|
39 |
+ updated: "Your password has been changed successfully. You are now signed in." |
|
40 |
+ updated_not_active: "Your password has been changed successfully." |
|
41 |
+ registrations: |
|
42 |
+ destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon." |
|
43 |
+ signed_up: "Welcome! You have signed up successfully." |
|
44 |
+ signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated." |
|
45 |
+ signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked." |
|
46 |
+ signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account." |
|
47 |
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address." |
|
48 |
+ updated: "Your account has been updated successfully." |
|
49 |
+ sessions: |
|
50 |
+ signed_in: "Signed in successfully." |
|
51 |
+ signed_out: "Signed out successfully." |
|
52 |
+ already_signed_out: "Signed out successfully." |
|
53 |
+ unlocks: |
|
54 |
+ send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes." |
|
55 |
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes." |
|
56 |
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue." |
|
4 | 57 |
errors: |
5 | 58 |
messages: |
59 |
+ already_confirmed: "was already confirmed, please try signing in" |
|
60 |
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one" |
|
6 | 61 |
expired: "has expired, please request a new one" |
7 | 62 |
not_found: "not found" |
8 |
- already_confirmed: "was already confirmed, please try signing in" |
|
9 | 63 |
not_locked: "was not locked" |
10 | 64 |
not_saved: |
11 | 65 |
one: "1 error prohibited this %{resource} from being saved:" |
12 | 66 |
other: "%{count} errors prohibited this %{resource} from being saved:" |
13 |
- |
|
14 |
- devise: |
|
15 |
- failure: |
|
16 |
- already_authenticated: 'You are already signed in.' |
|
17 |
- unauthenticated: 'You need to sign in or sign up before continuing.' |
|
18 |
- unconfirmed: 'You have to confirm your account before continuing.' |
|
19 |
- locked: 'Your account is locked.' |
|
20 |
- invalid: 'Invalid login or password.' |
|
21 |
- invalid_token: 'Invalid authentication token.' |
|
22 |
- timeout: 'Your session expired, please sign in again to continue.' |
|
23 |
- inactive: 'Your account was not activated yet.' |
|
24 |
- sessions: |
|
25 |
- signed_in: 'Signed in successfully.' |
|
26 |
- signed_out: 'Signed out successfully.' |
|
27 |
- passwords: |
|
28 |
- send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.' |
|
29 |
- updated: 'Your password was changed successfully. You are now signed in.' |
|
30 |
- updated_not_active: 'Your password was changed successfully.' |
|
31 |
- send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes." |
|
32 |
- no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided." |
|
33 |
- confirmations: |
|
34 |
- send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.' |
|
35 |
- send_paranoid_instructions: 'If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes.' |
|
36 |
- confirmed: 'Your account was successfully confirmed. You are now signed in.' |
|
37 |
- registrations: |
|
38 |
- signed_up: 'Welcome! You have signed up successfully.' |
|
39 |
- signed_up_but_unconfirmed: 'A message with a confirmation link has been sent to your email address. Please open the link to activate your account.' |
|
40 |
- signed_up_but_inactive: 'You have signed up successfully. However, we could not sign you in because your account is not yet activated.' |
|
41 |
- signed_up_but_locked: 'You have signed up successfully. However, we could not sign you in because your account is locked.' |
|
42 |
- updated: 'You updated your account successfully.' |
|
43 |
- update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address." |
|
44 |
- destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.' |
|
45 |
- unlocks: |
|
46 |
- send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.' |
|
47 |
- unlocked: 'Your account has been unlocked successfully. Please sign in to continue.' |
|
48 |
- send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.' |
|
49 |
- omniauth_callbacks: |
|
50 |
- success: 'Successfully authenticated from %{kind} account.' |
|
51 |
- failure: 'Could not authenticate you from %{kind} because "%{reason}".' |
|
52 |
- omniauth_providers: |
|
53 |
- twitter: 'Twitter' |
|
54 |
- tumblr: 'Tumblr' |
|
55 |
- github: 'GitHub' |
|
56 |
- 37signals: '37Signals (Basecamp)' |
|
57 |
- dropbox: 'Dropbox' |
|
58 |
- mailer: |
|
59 |
- confirmation_instructions: |
|
60 |
- subject: 'Confirmation instructions' |
|
61 |
- reset_password_instructions: |
|
62 |
- subject: 'Reset password instructions' |
|
63 |
- unlock_instructions: |
|
64 |
- subject: 'Unlock Instructions' |
@@ -66,9 +66,9 @@ Huginn::Application.routes.draw do |
||
66 | 66 |
post "/users/:user_id/webhooks/:agent_id/:secret" => "web_requests#handle_request" # legacy |
67 | 67 |
post "/users/:user_id/update_location/:secret" => "web_requests#update_location" # legacy |
68 | 68 |
|
69 |
- match '/auth/:provider/callback', to: 'services#callback', |
|
70 |
- via: [:get, :post] #, constraints: { provider: Regexp.union(Devise.omniauth_providers.map(&:to_s)) } |
|
71 |
- devise_for :users, :sign_out_via => [ :post, :delete ] |
|
69 |
+ devise_for :users, |
|
70 |
+ controllers: { omniauth_callbacks: 'omniauth_callbacks' }, |
|
71 |
+ sign_out_via: [:post, :delete] |
|
72 | 72 |
|
73 | 73 |
get "/about" => "home#about" |
74 | 74 |
root :to => "home#index" |
@@ -0,0 +1,26 @@ |
||
1 |
+require 'spec_helper' |
|
2 |
+ |
|
3 |
+describe OmniauthCallbacksController do |
|
4 |
+ before do |
|
5 |
+ sign_in users(:bob) |
|
6 |
+ OmniAuth.config.test_mode = true |
|
7 |
+ request.env["devise.mapping"] = Devise.mappings[:user] |
|
8 |
+ request.env["omniauth.auth"] = JSON.parse(File.read(Rails.root.join('spec/data_fixtures/services/twitter.json'))) |
|
9 |
+ end |
|
10 |
+ |
|
11 |
+ describe "accepting a callback url" do |
|
12 |
+ it "should update the user's credentials" do |
|
13 |
+ expect { |
|
14 |
+ get :twitter |
|
15 |
+ }.to change { users(:bob).services.count }.by(1) |
|
16 |
+ end |
|
17 |
+ |
|
18 |
+ # it "should work with an unknown provider (for now)" do |
|
19 |
+ # request.env["omniauth.auth"]['provider'] = 'unknown' |
|
20 |
+ # expect { |
|
21 |
+ # get :unknown |
|
22 |
+ # }.to change { users(:bob).services.count }.by(1) |
|
23 |
+ # expect(users(:bob).services.first.provider).to eq('unknown') |
|
24 |
+ # end |
|
25 |
+ end |
|
26 |
+end |
@@ -3,8 +3,6 @@ require 'spec_helper' |
||
3 | 3 |
describe ServicesController do |
4 | 4 |
before do |
5 | 5 |
sign_in users(:bob) |
6 |
- OmniAuth.config.test_mode = true |
|
7 |
- request.env["omniauth.auth"] = JSON.parse(File.read(Rails.root.join('spec/data_fixtures/services/twitter.json'))) |
|
8 | 6 |
end |
9 | 7 |
|
10 | 8 |
describe "GET index" do |
@@ -39,20 +37,4 @@ describe ServicesController do |
||
39 | 37 |
}.to raise_error(ActiveRecord::RecordNotFound) |
40 | 38 |
end |
41 | 39 |
end |
42 |
- |
|
43 |
- describe "accepting a callback url" do |
|
44 |
- it "should update the user's credentials" do |
|
45 |
- expect { |
|
46 |
- get :callback, provider: 'twitter' |
|
47 |
- }.to change { users(:bob).services.count }.by(1) |
|
48 |
- end |
|
49 |
- |
|
50 |
- it "should work with an unknown provider (for now)" do |
|
51 |
- request.env["omniauth.auth"]['provider'] = 'unknown' |
|
52 |
- expect { |
|
53 |
- get :callback, provider: 'unknown' |
|
54 |
- }.to change { users(:bob).services.count }.by(1) |
|
55 |
- expect(users(:bob).services.first.provider).to eq('unknown') |
|
56 |
- end |
|
57 |
- end |
|
58 | 40 |
end |